package ch06.shiLi.service;

import ch05.shiLi.util.User;
import ch06.shiLi.dao.UserDao;
import ch06.shiLi.dao.UserDaoImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;

//@Service("userService")
public class UserServiceImpl implements UserService {
//    @Resource(type = UserDaoImpl.class)

    @Autowired
    private UserDao dao;//声明接口类型引用

    public UserServiceImpl() {
    }

    public UserServiceImpl(UserDao dao) {
        this.dao = dao;
    }

    public UserDao getDao() {
        return dao;
    }

    public void setDao(UserDao dao) {
        this.dao = dao;
    }

    public void save(User user){
        dao.save(user);
    }
}
